package br.com.foxinline.util;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.UnknownHostException;

/**
 *
 * @author roniere
 */
public class Conexao {

    /**
     * Testa a connexão com a internet
     *
     * @return
     */
    public static boolean isInternetReachable() {
        try {
            URL url = new URL("http://www.google.com");

            HttpURLConnection urlConnect = (HttpURLConnection) url.openConnection();
            Object objData = urlConnect.getContent();

        } catch (UnknownHostException e) {
            return false;
        } catch (IOException e) {
            return false;
        }

        return true;
    }
}
